import React, {Component} from 'react';
import {Button, Select, Space} from "antd";

export default class Calculate extends Component {
    state={value:3}
    andleChange=(e)=>{
     this.setState({value:e})
    }

    incrementClick=()=>{
      const{value}=this.state
        console.log(this.props,'>>>>>')
        this.props.incre(value)
    }
    decreaseClick=()=>{
        const{value}=this.state
        this.props.decr(value)
    }
    render() {
        const {count}=this.props
        return (
            <div>
                <Space>
                <span>计算结果：{count}</span>
                <Select
                    defaultValue="1"
                    style={{ width: 120 }}
                    onChange={(e)=>this.andleChange(e)}
                    options={[
                        { value: 1, label: '1' },
                        { value: 2, label: '2' },
                        { value: 3, label: '3' },
                    ]}
                />
                <Button type='primary' onClick={this.incrementClick}>+</Button><Button type='primary' onClick={this.decreaseClick}>-</Button></Space>
            </div>
        );
    }
}
